<template>
  <div class="version">
    <pageCardFormVue
      title="版本信息"
      :pageCardConfig="versionConfig"
      v-model="formData"
    ></pageCardFormVue>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref, watch, PropType } from 'vue'
import { pageCardFormVue } from '@/render/components/page-card'
import { IVersion } from '@/render/store/baseconfig/types'
import { versionConfig } from '../config/version.config'
import emitter from '@/render/utils/mitt'
export default defineComponent({
  components: {
    pageCardFormVue
  },
  props: {
    modelValue: {
      type: Object as PropType<IVersion>,
      default: () => ({})
    }
  },
  emits: ['update:modelValue'],
  setup(props, { emit }) {
    const formData = ref({ ...props.modelValue })
    watch(
      formData,
      (newValue) => {
        emit('update:modelValue', newValue)
        emitter.emit('update-tab', 'emitter')
      },
      {
        deep: true
      }
    )

    return { versionConfig, formData }
  }
})
</script>

<style scoped lang="less">
.multi-input {
  width: 100%;
  display: flex;
  justify-content: space-between;
  .line {
    padding: 0 10px;
  }
}
</style>
